import Axios from '@/utils/request'
const baseUrl = 'api'

// 登录
export const login = (obj:any) => Axios.post(`/${baseUrl}/login`, obj)
// 获取管理员
export const systemList = (obj:any) => Axios.get(`/${baseUrl}/system/admin/?pageNum=${obj.pageNum}&pageSize=${obj.pageSize}&keywords=${obj.keywords}`)
// 添加管理员
export const addSystem = (obj:any) => Axios.post(`/${baseUrl}/system/admin/`, obj)
// 修改管理员
export const updateSystem = (obj:any) => Axios.put(`/${baseUrl}/system/admin/`, obj)
// 删除管理员
export const delSystem = (id:string) => Axios.delete(`/${baseUrl}/system/admin/${id}`)
// 宿舍楼信息
export const buildingList = (obj:any) => Axios.get(`/${baseUrl}/system/admin/dormitory/?pageNum=${obj.pageNum}&pageSize=${obj.pageSize}&keywords=${obj.keywords}`)
// 获取宿舍楼信息
export const buildingNameList = () => Axios.get(`/${baseUrl}/system/admin/dormitory/name/`)
// 添加宿舍楼
export const addBuilding = (obj:any) => Axios.post(`/${baseUrl}/system/admin/dormitory/`, obj)
// 修改宿舍楼
export const updateBuilding = (obj:any) => Axios.put(`/${baseUrl}/system/admin/dormitory/`, obj)
// 删除宿舍楼
export const delBuilding = (id:string) => Axios.delete(`/${baseUrl}/system/admin/dormitory/${id}`)
// 获取宿舍管理员
export const administratorList = (obj:any) => Axios.get(`/${baseUrl}/system/admin/administrator/?building_id=${obj.buildId}&pageNum=${obj.pageNum}&pageSize=${obj.pageSize}&keywords=${obj.keywords}`)
// 修改宿舍管理员删除
export const addAdministrator = (obj:any) => Axios.post(`/${baseUrl}/system/admin/administrator/`, obj)
// 修改宿舍管理员绑定
export const updateAdministrator = (obj:any) => Axios.put(`/${baseUrl}/system/admin/administrator/`, obj)
// 获取
export const getAdministratorName = () => Axios.get(`/${baseUrl}/system/admin/administrator/name`)
// 解除宿舍管理员绑定 确定：解绑当前宿舍楼，可以解绑当前用户所有宿舍楼，未优化
export const delAdministrator = (id:string) => Axios.delete(`/${baseUrl}/system/admin/administrator/?id=${id}`)
// 卫生管理列表
export const ambientList = (obj:any) => Axios.get(`/${baseUrl}/system/dorm/ambient/?building_type=${obj.buildingType}&building_id=${obj.buildId}&pageNum=${obj.pageNum}&pageSize=${obj.pageSize}&keywords=${obj.keywords}`)
// 添加卫生
export const addAmbient = (obj:any) => Axios.post(`/${baseUrl}/system/dorm/ambient/`, obj)
// 修改卫生
export const updateAmbient = (obj:any) => Axios.put(`/${baseUrl}/system/dorm/ambient/`, obj)
// 删除卫生
export const delAmbient = (id:string) => Axios.delete(`/${baseUrl}/system/dorm/ambient/${id}`)
// 晚归管理
export const outLateList = (obj:any) => Axios.get(`/${baseUrl}/system/dorm/outlate/?building_type=${obj.buildingType}&building_id=${obj.buildId}&pageNum=${obj.pageNum}&pageSize=${obj.pageSize}&keywords=${obj.keywords}`)
// 添加晚归
export const addOutlate = (obj:any) => Axios.post(`/${baseUrl}/system/dorm/outlate/`, obj)
// 修改晚归
export const updateOutlate = (obj:any) => Axios.put(`/${baseUrl}/system/dorm/outlate/`, obj)
// 删除晚归
export const delOutlate = (id:string) => Axios.delete(`/${baseUrl}/system/dorm/outlate/${id}`)
// 维修管理
export const repairList = (obj:any) => Axios.get(`/${baseUrl}/system/dorm/repair/?buildingId=${obj.buildId}&pageNum=${obj.pageNum}&pageSize=${obj.pageSize}&keywords=${obj.keywords}`)
// 修改维修
export const updateRepair = (obj:any) => Axios.put(`/${baseUrl}/system/dorm/repair/`, obj)
// 添加维修
export const addRepair = (obj:any) => Axios.post(`/${baseUrl}/system/dorm/repair/`, obj)
// 删除维修
export const delRepair = (id:string) => Axios.delete(`/${baseUrl}/system/dorm/repair/${id}`)
// 一键处理
export const handleRepair = (obj:any) => Axios.put(`/${baseUrl}/system/dorm/repair/enabled/`, obj)
// 访客管理
export const visitorList = (obj:any) => Axios.get(`/${baseUrl}/system/dorm/visitor/?buildingId=${obj.buildId}&pageNum=${obj.pageNum}&pageSize=${obj.pageSize}&keywords=${obj.keywords}`)
// 添加访客
export const addVisitor = (obj:any) => Axios.post(`/${baseUrl}/system/dorm/visitor/`, obj)
// 修改访客
export const updateVisitor = (obj:any) => Axios.put(`/${baseUrl}/system/dorm/visitor/`, obj)
// 删除访客
export const delVisitor = (id:string) => Axios.delete(`/${baseUrl}/system/dorm/visitor/${id}`)
// 重置密码
export const restPwd = (obj:any) => Axios.put(`/${baseUrl}/update/password/`, obj)
// 获取信息
export const getInfo = () => Axios.get(`/${baseUrl}/dorm/building`)
